//
//  RDLinkedInEngine.h
//  LinkedInClientLibrary
//
//  Created by Sixten Otto on 12/30/09.
//  Copyright 2010 Results Direct. All rights reserved.
//
//  Significant inspiration and code from MGTwitterEngine by Matt Gemmell
//    and the OAuth enhancements to same by Ben Gottlieb
//  <http://mattgemmell.com/source#mgtwitterengine>
//  <http://github.com/bengottlieb/Twitter-OAuth-iPhone>
//

#import <Foundation/Foundation.h>
#import "FOAuthDelegate.h"

@class OAConsumer;
@class OAToken;
@class OAMutableURLRequest;

@interface FOAuthEngine : NSObject {
	id<FOAuthDelegate>	  oAuthDelegate;
	OAConsumer			* oAuthConsumer;
	OAToken				* oAuthRequestToken;
	OAToken				* oAuthAccessToken;
	NSString			* oAuthVerifier;
    
	NSString			* kAPIBaseURL;
    NSString			* kOAuthRequestTokenURL;
	NSString			* kOAuthAccessTokenURL ;
	NSString			* kOAuthAuthorizeURL;
	NSString			* kOAuthInvalidateURL;
	NSString			* kOAuthCallBackURL;
	NSString			* kOAuthCancelCallBackURL;
}

@property (nonatomic, readonly) BOOL isAuthorized;
@property (nonatomic, readonly) BOOL hasRequestToken;
@property (nonatomic, retain) NSString* verifier;

+ (id)engineWithConsumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecret delegate:(id<FOAuthDelegate>)delegate;
- (id)initWithConsumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecret delegate:(id<FOAuthDelegate>)delegate;

// authorization
- (void)requestRequestToken;
- (void)requestAccessToken;
- (void)requestTokenInvalidation;
- (NSURLRequest *)authorizationFormURLRequest;
- (BOOL)isOAuthCallBackURL:(NSString *) hostName;
- (BOOL)isOAuthCancelCallBackURL:(NSString *) hostName;

//get current user information
- (OAMutableURLRequest *)profileForCurrentUser;
- (OAMutableURLRequest *)sendAPIRequestWithURL:(NSURL *)url HTTPMethod:(NSString *)method body:(NSData *)body;
@end
